package com.googlecode.hypersphere.ws2ejb3.oaw;

import j2ee.EntityType;

public class Util {

	public static String firstUpperCase(String string) {
		return string.substring(0, 1).toUpperCase() + string.substring(1);
	}
	
	public static String toString(String string) {
		return string;
	}
	
	public static String getPackage(EntityType entity) {
		String result = entity.getEjbClass();
		if (result.contains(".")) {
			StringBuffer buffer = new StringBuffer(result);
			result = buffer.substring(0, buffer.indexOf(".")).toString();
		}
		else
		{
			result = "";
		}
		return result; 
	}
	
	public static String getPackageUri(EntityType entity) {
		return Util.getPackage(entity).replaceAll("\\.", "/") + "/";
	}

}
